home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2000 #5
/
Amiga Plus CD - 2000 - No. 5.iso
/
Tools
/
Misc
/
InstallerNG
/
developer
/
gui
/
example
/
igui_CopyConfirm.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-10-28
|
4KB
|
153 lines
#include "includes.h"
#include "installergui_data.h"
/********************************************************************
*
* DESCRIPTION
*
*/
/********************************************************************
*
* STATIC
*
*/
static void __asm __saveds copyconfirm_hookfun(register __a2 APTR , register __a1 LONG *);
static const struct Hook copyconfirm_hook = { { NULL, NULL }, (VOID *) copyconfirm_hookfun, NULL, NULL };
/********************************************************************
*
* EXTERN
*
*/
/********************************************************************
*
* PUBLIC
*
*/
/********************************************************************
*
* CODE
*
*/
long __asm igui_CopyConfirm(register __a0 APTR application,
register __a1 struct FunctionEnvironment *localenv)
{
#ifdef DEBUG
DEBUG_MAKRO
#endif
{
struct Application *app = (struct Application *) application;
long retval = 1,
event;
///// BPTR olddir;
// create the object
APTR PO_path, HV_space,
obj = GroupObject,
Child, TextObject,
MUIA_Frame, MUIV_Frame_None,
MUIA_Text_Contents, localenv->fe_Prompt,
MUIA_Text_SetMin, TRUE,
MUIA_Text_PreParse, "\33c",
End,
Child, app->app_DirlistList,
Child, HV_space = HVSpace,
Child, GroupObject,
MUIA_Group_Horiz, TRUE,
Child, Label(app->app_Texts[DESTDIR]),
Child, PO_path = PopaslObject,
MUIA_Popasl_Type, ASL_FileRequest,
ASLFR_DrawersOnly, TRUE,
MUIA_Popstring_String, String(localenv->fe_Dest, 80),
MUIA_Popstring_Button, PopButton(MUII_PopFile),
End,
//Child, HSpace(10),
//Child, BT_all = SimpleButton("All"),
//Child, BT_none = SimpleButton("None"),
End,
End;
if (obj)
{
DoMethod(PO_path, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
MUIV_Notify_Self, 3, MUIM_CallHook, ©confirm_hook, &(localenv->fe_Dest));
// make the space invisible now!
set(HV_space, MUIA_ShowMe, FALSE);
// set the help-text for this function
igui_SetHelp(app, (char *) localenv->fe_Help);
// message object erzeugen und warten
if (guistuff_NewContent(app, obj))
{
// rename the "cancel" button to "skip this part"
igui_NameCancel(app, app->app_Texts[BUTTON_SKIP]);
// wait, until the user "proceeds", "skips" or confirms the "quit" action
do
{
event = igui_QuietWaitApp(app);
if (event == GUIEVENT_PROCEED) { retval = 1; break; }
else if (event == GUIEVENT_ABORT) { retval = 0; break; }
}
while (guistuff_HandleGUIEvent(app, event));
// restore the "cancel" button
igui_NameCancel(app, app->app_Texts[BUTTON_PROCEED_INSTALL]);
// before we quit, we must remove the dirlist from the group;
// otherwise mui would dispose the dirlist and this would lead a crash!
if(DoMethod(obj, MUIM_Group_InitChange))
{
// for better look, we show the space now to avoid window zipping
set(HV_space, MUIA_ShowMe, TRUE);
DoMethod(obj, OM_REMMEMBER, app->app_DirlistList);
DoMethod(obj, MUIM_Group_ExitChange);
}
}
else { /* NO GUI OBjECT */ }
}
else { /* NO GUI OBjECT */ }
igui_EmptyPanel(app);
return(retval);
}
}
/******************************************************************************/
static void __asm __saveds copyconfirm_hookfun(register __a2 APTR obj, register __a1 LONG *data)
{
// data[0] holds the address of localenv->fe_Dest
// if the content of the "Destination directory:" string-gadget changes,
// we have to use the new content as the localenv->fe_Dest value, such that
// the insataller COPYFILES knows about the new destination!
char *dest, *newdest;
GetAttr(MUIA_String_Contents, (APTR) obj, (APTR) &dest);
if (newdest = sav_DupString2(dest))
{
*((APTR *) data[0]) = (APTR) newdest;
}
else
{
DisplayBeep(NULL);
SetAttrs(obj, MUIA_String_Contents, *((APTR *) data[0]), TAG_DONE);
}
}